﻿#pragma once

#include <boost/asio.hpp>
#include "client_base.h"

class ClientAsio : public ClientBase {
public:
	ClientAsio();
	virtual void Start(unsigned short port, const char* message) override;
	virtual void Stop() override;
	virtual void Wait() override;

private:
	void OnConnect(boost::system::error_code error);
	void OnRead(boost::system::error_code error, size_t size);
	void OnWrite(boost::system::error_code error, size_t size);
	std::thread thread_;
	boost::asio::io_context io_context_;
	boost::asio::ip::tcp::socket socket_;
	std::vector<char> read_buffer_;
	std::vector<char> write_buffer_;

};